<!-- HTML header for doxygen 1.8.6-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/xhtml;charset=utf-8" http-equiv="Content-Type"/>
<meta content="IE=9" http-equiv="X-UA-Compatible"/>
<meta content="Doxygen 1.8.13" name="generator"/>
<title>OpenCV: cv::face::FaceRecognizer Class Reference</title>
<link href="../../opencv.ico" rel="shortcut icon" type="image/x-icon"/>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script src="../../jquery.js" type="text/javascript"></script>
<script src="../../dynsections.js" type="text/javascript"></script>
<script src="../../tutorial-utils.js" type="text/javascript"></script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script src="../../search/searchdata.js" type="text/javascript"></script>
<script src="../../search/search.js" type="text/javascript"></script>
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
    jax: ["input/TeX","output/HTML-CSS"],
});
//<![CDATA[
MathJax.Hub.Config(
{
  TeX: {
      Macros: {
          matTT: [ "\\[ \\left|\\begin{array}{ccc} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \\end{array}\\right| \\]", 9],
          fork: ["\\left\\{ \\begin{array}{l l} #1 & \\mbox{#2}\\\\ #3 & \\mbox{#4}\\\\ \\end{array} \\right.", 4],
          forkthree: ["\\left\\{ \\begin{array}{l l} #1 & \\mbox{#2}\\\\ #3 & \\mbox{#4}\\\\ #5 & \\mbox{#6}\\\\ \\end{array} \\right.", 6],
          forkfour: ["\\left\\{ \\begin{array}{l l} #1 & \\mbox{#2}\\\\ #3 & \\mbox{#4}\\\\ #5 & \\mbox{#6}\\\\ #7 & \\mbox{#8}\\\\ \\end{array} \\right.", 8],
          vecthree: ["\\begin{bmatrix} #1\\\\ #2\\\\ #3 \\end{bmatrix}", 3],
          vecthreethree: ["\\begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \\end{bmatrix}", 9],
          cameramatrix: ["#1 = \\begin{bmatrix} f_x & 0 & c_x\\\\ 0 & f_y & c_y\\\\ 0 & 0 & 1 \\end{bmatrix}", 1],
          distcoeffs: ["(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6 [, s_1, s_2, s_3, s_4[, \\tau_x, \\tau_y]]]]) \\text{ of 4, 5, 8, 12 or 14 elements}"],
          distcoeffsfisheye: ["(k_1, k_2, k_3, k_4)"],
          hdotsfor: ["\\dots", 1],
          mathbbm: ["\\mathbb{#1}", 1],
          bordermatrix: ["\\matrix{#1}", 1]
      }
  }
}
);
//]]>
</script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js" type="text/javascript"></script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css"/>
<link href="../../stylesheet.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<!--#include virtual="/google-search.html"-->
<table cellpadding="0" cellspacing="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="../../opencv-logo-small.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">OpenCV
    <span id="projectnumber">4.5.2</span>
   </div>
   <div id="projectbrief">Open Source Computer Vision</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
</script>
<script src="../../menudata.js" type="text/javascript"></script>
<script src="../../menu.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
  initMenu('../../',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow" onkeydown="return searchBox.OnSearchSelectKey(event)" onmouseout="return searchBox.OnSearchSelectHide()" onmouseover="return searchBox.OnSearchSelectShow()">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe frameborder="0" id="MSearchResults" name="MSearchResults" src="javascript:void(0)">
</iframe>
</div>
<div class="navpath" id="nav-path">
  <ul>
<li class="navelem"><a class="el" href="../../d2/d75/namespacecv.html">cv</a></li><li class="navelem"><a class="el" href="../../d4/d48/namespacecv_1_1face.html">face</a></li><li class="navelem"><a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html">FaceRecognizer</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> |
<a href="#pro-attribs">Protected Attributes</a> |
<a href="../../d3/dc8/classcv_1_1face_1_1FaceRecognizer-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">cv::face::FaceRecognizer Class Reference<span class="mlabels"><span class="mlabel">abstract</span></span><div class="ingroups"><a class="el" href="../../db/d7c/group__face.html">Face Analysis</a></div></div>  </div>
</div><!--header-->
<div class="contents">
<p>Abstract base class for all face recognition models.  
 <a href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html#details">More...</a></p>
<p><code>#include &lt;opencv2/face.hpp&gt;</code></p>
<div class="dynheader">
Inheritance diagram for cv::face::FaceRecognizer:</div>
<div class="dyncontent">
 <div class="center">
  <img alt="" src="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.png" usemap="#cv::face::FaceRecognizer_map"/>
  <map id="cv::face::FaceRecognizer_map" name="cv::face::FaceRecognizer_map">
<area alt="cv::Algorithm" coords="202,0,394,24" href="../../d3/d46/classcv_1_1Algorithm.html" shape="rect" title="This is a base class for all more or less complex algorithms in OpenCV. "/>
<area alt="cv::face::BasicFaceRecognizer" coords="101,112,293,136" href="../../dc/dd7/classcv_1_1face_1_1BasicFaceRecognizer.html" shape="rect"/>
<area alt="cv::face::LBPHFaceRecognizer" coords="303,112,495,136" href="../../df/d25/classcv_1_1face_1_1LBPHFaceRecognizer.html" shape="rect"/>
<area alt="cv::face::EigenFaceRecognizer" coords="0,168,192,192" href="../../dd/d7c/classcv_1_1face_1_1EigenFaceRecognizer.html" shape="rect"/>
<area alt="cv::face::FisherFaceRecognizer" coords="202,168,394,192" href="../../d2/de9/classcv_1_1face_1_1FisherFaceRecognizer.html" shape="rect"/>
</map>
 </div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:aa60dc36e03135d32b94deaf1bad873f3"><td align="right" class="memItemLeft" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html#aa60dc36e03135d32b94deaf1bad873f3">empty</a> () const <a class="el" href="../../db/de0/group__core__utils.html#ga4d89d63e402ef9ddc48e18e21180fe4a">CV_OVERRIDE</a>=0</td></tr>
<tr class="separator:aa60dc36e03135d32b94deaf1bad873f3"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aa51b8afce8ffe8b77c26f15be27b930d"><td align="right" class="memItemLeft" valign="top">virtual <a class="el" href="../../dc/d84/group__core__basic.html#ga1f6634802eeadfd7245bc75cf3e216c2">String</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html#aa51b8afce8ffe8b77c26f15be27b930d">getLabelInfo</a> (int label) const</td></tr>
<tr class="memdesc:aa51b8afce8ffe8b77c26f15be27b930d"><td class="mdescLeft"> </td><td class="mdescRight">Gets string information by label.  <a href="#aa51b8afce8ffe8b77c26f15be27b930d">More...</a><br/></td></tr>
<tr class="separator:aa51b8afce8ffe8b77c26f15be27b930d"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a68e818dcdadba76574a597db49b233ce"><td align="right" class="memItemLeft" valign="top">virtual std::vector&lt; int &gt; </td><td class="memItemRight" valign="bottom"><a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html#a68e818dcdadba76574a597db49b233ce">getLabelsByString</a> (const <a class="el" href="../../dc/d84/group__core__basic.html#ga1f6634802eeadfd7245bc75cf3e216c2">String</a> &amp;str) const</td></tr>
<tr class="memdesc:a68e818dcdadba76574a597db49b233ce"><td class="mdescLeft"> </td><td class="mdescRight">Gets vector of labels by string.  <a href="#a68e818dcdadba76574a597db49b233ce">More...</a><br/></td></tr>
<tr class="separator:a68e818dcdadba76574a597db49b233ce"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ad0ce3ced9c89b5aca528e8490dc18969"><td align="right" class="memItemLeft" valign="top">virtual double </td><td class="memItemRight" valign="bottom"><a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html#ad0ce3ced9c89b5aca528e8490dc18969">getThreshold</a> () const =0</td></tr>
<tr class="memdesc:ad0ce3ced9c89b5aca528e8490dc18969"><td class="mdescLeft"> </td><td class="mdescRight">threshold parameter accessor - required for default BestMinDist collector  <a href="#ad0ce3ced9c89b5aca528e8490dc18969">More...</a><br/></td></tr>
<tr class="separator:ad0ce3ced9c89b5aca528e8490dc18969"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aa2d2f02faffab1bf01317ae6502fb631"><td align="right" class="memItemLeft" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html#aa2d2f02faffab1bf01317ae6502fb631">predict</a> (<a class="el" href="../../dc/d84/group__core__basic.html#ga353a9de602fe76c709e12074a6f362ba">InputArray</a> src) const</td></tr>
<tr class="separator:aa2d2f02faffab1bf01317ae6502fb631"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ab0d593e53ebd9a0f350c989fcac7f251"><td align="right" class="memItemLeft" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html#ab0d593e53ebd9a0f350c989fcac7f251">predict</a> (<a class="el" href="../../dc/d84/group__core__basic.html#ga353a9de602fe76c709e12074a6f362ba">InputArray</a> src, int &amp;label, double &amp;confidence) const</td></tr>
<tr class="memdesc:ab0d593e53ebd9a0f350c989fcac7f251"><td class="mdescLeft"> </td><td class="mdescRight">Predicts a label and associated confidence (e.g. distance) for a given input image.  <a href="#ab0d593e53ebd9a0f350c989fcac7f251">More...</a><br/></td></tr>
<tr class="separator:ab0d593e53ebd9a0f350c989fcac7f251"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:afc5af8e603b525e9cdc6b3ddcd7cf83f"><td align="right" class="memItemLeft" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html#afc5af8e603b525e9cdc6b3ddcd7cf83f">predict</a> (<a class="el" href="../../dc/d84/group__core__basic.html#ga353a9de602fe76c709e12074a6f362ba">InputArray</a> src, <a class="el" href="../../dc/d84/group__core__basic.html#ga6395ca871a678020c4a31fadf7e8cc63">Ptr</a>&lt; <a class="el" href="../../da/d6a/classcv_1_1face_1_1PredictCollector.html">PredictCollector</a> &gt; collector) const =0</td></tr>
<tr class="memdesc:afc5af8e603b525e9cdc6b3ddcd7cf83f"><td class="mdescLeft"> </td><td class="mdescRight"><ul>
<li>if implemented - send all result of prediction to collector that can be used for somehow custom result handling </li>
</ul>
 <a href="#afc5af8e603b525e9cdc6b3ddcd7cf83f">More...</a><br/></td></tr>
<tr class="separator:afc5af8e603b525e9cdc6b3ddcd7cf83f"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:acc42e5b04595dba71f0777c7179af8c3"><td align="right" class="memItemLeft" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html#acc42e5b04595dba71f0777c7179af8c3">read</a> (const <a class="el" href="../../dc/d84/group__core__basic.html#ga1f6634802eeadfd7245bc75cf3e216c2">String</a> &amp;filename)</td></tr>
<tr class="memdesc:acc42e5b04595dba71f0777c7179af8c3"><td class="mdescLeft"> </td><td class="mdescRight">Loads a <a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html" title="Abstract base class for all face recognition models. ">FaceRecognizer</a> and its model state.  <a href="#acc42e5b04595dba71f0777c7179af8c3">More...</a><br/></td></tr>
<tr class="separator:acc42e5b04595dba71f0777c7179af8c3"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a6ce52a3c8941aaa3cd09c31d6a6ef192"><td align="right" class="memItemLeft" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html#a6ce52a3c8941aaa3cd09c31d6a6ef192">read</a> (const <a class="el" href="../../de/dd9/classcv_1_1FileNode.html">FileNode</a> &amp;fn) <a class="el" href="../../db/de0/group__core__utils.html#ga4d89d63e402ef9ddc48e18e21180fe4a">CV_OVERRIDE</a>=0</td></tr>
<tr class="separator:a6ce52a3c8941aaa3cd09c31d6a6ef192"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aabcb47adcddd719974681b2b7309d656"><td align="right" class="memItemLeft" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html#aabcb47adcddd719974681b2b7309d656">setLabelInfo</a> (int label, const <a class="el" href="../../dc/d84/group__core__basic.html#ga1f6634802eeadfd7245bc75cf3e216c2">String</a> &amp;strInfo)</td></tr>
<tr class="memdesc:aabcb47adcddd719974681b2b7309d656"><td class="mdescLeft"> </td><td class="mdescRight">Sets string info for the specified model's label.  <a href="#aabcb47adcddd719974681b2b7309d656">More...</a><br/></td></tr>
<tr class="separator:aabcb47adcddd719974681b2b7309d656"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a3182081e5f8023e658ad8ab96656dd63"><td align="right" class="memItemLeft" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html#a3182081e5f8023e658ad8ab96656dd63">setThreshold</a> (double val)=0</td></tr>
<tr class="memdesc:a3182081e5f8023e658ad8ab96656dd63"><td class="mdescLeft"> </td><td class="mdescRight">Sets threshold of model.  <a href="#a3182081e5f8023e658ad8ab96656dd63">More...</a><br/></td></tr>
<tr class="separator:a3182081e5f8023e658ad8ab96656dd63"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ac8680c2aa9649ad3f55e27761165c0d6"><td align="right" class="memItemLeft" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html#ac8680c2aa9649ad3f55e27761165c0d6">train</a> (<a class="el" href="../../dc/d84/group__core__basic.html#ga606feabe3b50ab6838f1ba89727aa07a">InputArrayOfArrays</a> src, <a class="el" href="../../dc/d84/group__core__basic.html#ga353a9de602fe76c709e12074a6f362ba">InputArray</a> labels)=0</td></tr>
<tr class="memdesc:ac8680c2aa9649ad3f55e27761165c0d6"><td class="mdescLeft"> </td><td class="mdescRight">Trains a <a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html" title="Abstract base class for all face recognition models. ">FaceRecognizer</a> with given data and associated labels.  <a href="#ac8680c2aa9649ad3f55e27761165c0d6">More...</a><br/></td></tr>
<tr class="separator:ac8680c2aa9649ad3f55e27761165c0d6"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a8a4e73ea878dcd0c235d0487189d25f3"><td align="right" class="memItemLeft" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html#a8a4e73ea878dcd0c235d0487189d25f3">update</a> (<a class="el" href="../../dc/d84/group__core__basic.html#ga606feabe3b50ab6838f1ba89727aa07a">InputArrayOfArrays</a> src, <a class="el" href="../../dc/d84/group__core__basic.html#ga353a9de602fe76c709e12074a6f362ba">InputArray</a> labels)</td></tr>
<tr class="memdesc:a8a4e73ea878dcd0c235d0487189d25f3"><td class="mdescLeft"> </td><td class="mdescRight">Updates a <a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html" title="Abstract base class for all face recognition models. ">FaceRecognizer</a> with given data and associated labels.  <a href="#a8a4e73ea878dcd0c235d0487189d25f3">More...</a><br/></td></tr>
<tr class="separator:a8a4e73ea878dcd0c235d0487189d25f3"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a2adf2d555550194244b05c91fefcb4d6"><td align="right" class="memItemLeft" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html#a2adf2d555550194244b05c91fefcb4d6">write</a> (const <a class="el" href="../../dc/d84/group__core__basic.html#ga1f6634802eeadfd7245bc75cf3e216c2">String</a> &amp;filename) const</td></tr>
<tr class="memdesc:a2adf2d555550194244b05c91fefcb4d6"><td class="mdescLeft"> </td><td class="mdescRight">Saves a <a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html" title="Abstract base class for all face recognition models. ">FaceRecognizer</a> and its model state.  <a href="#a2adf2d555550194244b05c91fefcb4d6">More...</a><br/></td></tr>
<tr class="separator:a2adf2d555550194244b05c91fefcb4d6"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a4756dbf9b97408ba5f3677296c3a1695"><td align="right" class="memItemLeft" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html#a4756dbf9b97408ba5f3677296c3a1695">write</a> (<a class="el" href="../../da/d56/classcv_1_1FileStorage.html">FileStorage</a> &amp;fs) const <a class="el" href="../../db/de0/group__core__utils.html#ga4d89d63e402ef9ddc48e18e21180fe4a">CV_OVERRIDE</a>=0</td></tr>
<tr class="separator:a4756dbf9b97408ba5f3677296c3a1695"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="inherit_header pub_methods_classcv_1_1Algorithm"><td colspan="2" onclick="javascript:toggleInherit('pub_methods_classcv_1_1Algorithm')"><img alt="-" src="../../closed.png"/> Public Member Functions inherited from <a class="el" href="../../d3/d46/classcv_1_1Algorithm.html">cv::Algorithm</a></td></tr>
<tr class="memitem:a827c8b2781ed17574805f373e6054ff1 inherit pub_methods_classcv_1_1Algorithm"><td align="right" class="memItemLeft" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d46/classcv_1_1Algorithm.html#a827c8b2781ed17574805f373e6054ff1">Algorithm</a> ()</td></tr>
<tr class="separator:a827c8b2781ed17574805f373e6054ff1 inherit pub_methods_classcv_1_1Algorithm"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a8ae826127fa0f1f8d10a24841bd376f8 inherit pub_methods_classcv_1_1Algorithm"><td align="right" class="memItemLeft" valign="top">virtual </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d46/classcv_1_1Algorithm.html#a8ae826127fa0f1f8d10a24841bd376f8">~Algorithm</a> ()</td></tr>
<tr class="separator:a8ae826127fa0f1f8d10a24841bd376f8 inherit pub_methods_classcv_1_1Algorithm"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aec9c965448e4dc851d7cacd3abd84cd1 inherit pub_methods_classcv_1_1Algorithm"><td align="right" class="memItemLeft" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d46/classcv_1_1Algorithm.html#aec9c965448e4dc851d7cacd3abd84cd1">clear</a> ()</td></tr>
<tr class="memdesc:aec9c965448e4dc851d7cacd3abd84cd1 inherit pub_methods_classcv_1_1Algorithm"><td class="mdescLeft"> </td><td class="mdescRight">Clears the algorithm state.  <a href="../../d3/d46/classcv_1_1Algorithm.html#aec9c965448e4dc851d7cacd3abd84cd1">More...</a><br/></td></tr>
<tr class="separator:aec9c965448e4dc851d7cacd3abd84cd1 inherit pub_methods_classcv_1_1Algorithm"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a286fc82744ccab3d248aca44524266a9 inherit pub_methods_classcv_1_1Algorithm"><td align="right" class="memItemLeft" valign="top">virtual <a class="el" href="../../dc/d84/group__core__basic.html#ga1f6634802eeadfd7245bc75cf3e216c2">String</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d46/classcv_1_1Algorithm.html#a286fc82744ccab3d248aca44524266a9">getDefaultName</a> () const</td></tr>
<tr class="separator:a286fc82744ccab3d248aca44524266a9 inherit pub_methods_classcv_1_1Algorithm"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a0a880744bc4e3f45711444571df47d67 inherit pub_methods_classcv_1_1Algorithm"><td align="right" class="memItemLeft" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d46/classcv_1_1Algorithm.html#a0a880744bc4e3f45711444571df47d67">save</a> (const <a class="el" href="../../dc/d84/group__core__basic.html#ga1f6634802eeadfd7245bc75cf3e216c2">String</a> &amp;filename) const</td></tr>
<tr class="separator:a0a880744bc4e3f45711444571df47d67 inherit pub_methods_classcv_1_1Algorithm"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a763a62d1b03042eef7d7fc3ac6c87c79 inherit pub_methods_classcv_1_1Algorithm"><td align="right" class="memItemLeft" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d46/classcv_1_1Algorithm.html#a763a62d1b03042eef7d7fc3ac6c87c79">write</a> (const <a class="el" href="../../dc/d84/group__core__basic.html#ga6395ca871a678020c4a31fadf7e8cc63">Ptr</a>&lt; <a class="el" href="../../da/d56/classcv_1_1FileStorage.html">FileStorage</a> &gt; &amp;fs, const <a class="el" href="../../dc/d84/group__core__basic.html#ga1f6634802eeadfd7245bc75cf3e216c2">String</a> &amp;name=<a class="el" href="../../dc/d84/group__core__basic.html#ga1f6634802eeadfd7245bc75cf3e216c2">String</a>()) const</td></tr>
<tr class="memdesc:a763a62d1b03042eef7d7fc3ac6c87c79 inherit pub_methods_classcv_1_1Algorithm"><td class="mdescLeft"> </td><td class="mdescRight">simplified API for language bindings This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.  <a href="../../d3/d46/classcv_1_1Algorithm.html#a763a62d1b03042eef7d7fc3ac6c87c79">More...</a><br/></td></tr>
<tr class="separator:a763a62d1b03042eef7d7fc3ac6c87c79 inherit pub_methods_classcv_1_1Algorithm"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-attribs"></a>
Protected Attributes</h2></td></tr>
<tr class="memitem:aa24774c798eb4d682d8ee10dbf9c8c45"><td align="right" class="memItemLeft" valign="top">std::map&lt; int, <a class="el" href="../../dc/d84/group__core__basic.html#ga1f6634802eeadfd7245bc75cf3e216c2">String</a> &gt; </td><td class="memItemRight" valign="bottom"><a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html#aa24774c798eb4d682d8ee10dbf9c8c45">_labelsInfo</a></td></tr>
<tr class="separator:aa24774c798eb4d682d8ee10dbf9c8c45"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="inherited"></a>
Additional Inherited Members</h2></td></tr>
<tr class="inherit_header pub_static_methods_classcv_1_1Algorithm"><td colspan="2" onclick="javascript:toggleInherit('pub_static_methods_classcv_1_1Algorithm')"><img alt="-" src="../../closed.png"/> Static Public Member Functions inherited from <a class="el" href="../../d3/d46/classcv_1_1Algorithm.html">cv::Algorithm</a></td></tr>
<tr class="memitem:a623841c33b58ea9c4847da04607e067b inherit pub_static_methods_classcv_1_1Algorithm"><td class="memTemplParams" colspan="2">template&lt;typename _Tp &gt; </td></tr>
<tr class="memitem:a623841c33b58ea9c4847da04607e067b inherit pub_static_methods_classcv_1_1Algorithm"><td align="right" class="memTemplItemLeft" valign="top">static <a class="el" href="../../dc/d84/group__core__basic.html#ga6395ca871a678020c4a31fadf7e8cc63">Ptr</a>&lt; _Tp &gt; </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="../../d3/d46/classcv_1_1Algorithm.html#a623841c33b58ea9c4847da04607e067b">load</a> (const <a class="el" href="../../dc/d84/group__core__basic.html#ga1f6634802eeadfd7245bc75cf3e216c2">String</a> &amp;filename, const <a class="el" href="../../dc/d84/group__core__basic.html#ga1f6634802eeadfd7245bc75cf3e216c2">String</a> &amp;objname=<a class="el" href="../../dc/d84/group__core__basic.html#ga1f6634802eeadfd7245bc75cf3e216c2">String</a>())</td></tr>
<tr class="memdesc:a623841c33b58ea9c4847da04607e067b inherit pub_static_methods_classcv_1_1Algorithm"><td class="mdescLeft"> </td><td class="mdescRight">Loads algorithm from the file.  <a href="../../d3/d46/classcv_1_1Algorithm.html#a623841c33b58ea9c4847da04607e067b">More...</a><br/></td></tr>
<tr class="separator:a623841c33b58ea9c4847da04607e067b inherit pub_static_methods_classcv_1_1Algorithm"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a3ba305a10d02479c13cf7d169c321547 inherit pub_static_methods_classcv_1_1Algorithm"><td class="memTemplParams" colspan="2">template&lt;typename _Tp &gt; </td></tr>
<tr class="memitem:a3ba305a10d02479c13cf7d169c321547 inherit pub_static_methods_classcv_1_1Algorithm"><td align="right" class="memTemplItemLeft" valign="top">static <a class="el" href="../../dc/d84/group__core__basic.html#ga6395ca871a678020c4a31fadf7e8cc63">Ptr</a>&lt; _Tp &gt; </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="../../d3/d46/classcv_1_1Algorithm.html#a3ba305a10d02479c13cf7d169c321547">loadFromString</a> (const <a class="el" href="../../dc/d84/group__core__basic.html#ga1f6634802eeadfd7245bc75cf3e216c2">String</a> &amp;strModel, const <a class="el" href="../../dc/d84/group__core__basic.html#ga1f6634802eeadfd7245bc75cf3e216c2">String</a> &amp;objname=<a class="el" href="../../dc/d84/group__core__basic.html#ga1f6634802eeadfd7245bc75cf3e216c2">String</a>())</td></tr>
<tr class="memdesc:a3ba305a10d02479c13cf7d169c321547 inherit pub_static_methods_classcv_1_1Algorithm"><td class="mdescLeft"> </td><td class="mdescRight">Loads algorithm from a String.  <a href="../../d3/d46/classcv_1_1Algorithm.html#a3ba305a10d02479c13cf7d169c321547">More...</a><br/></td></tr>
<tr class="separator:a3ba305a10d02479c13cf7d169c321547 inherit pub_static_methods_classcv_1_1Algorithm"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ad8c591bacb34c485f5b7a250c314fc53 inherit pub_static_methods_classcv_1_1Algorithm"><td class="memTemplParams" colspan="2">template&lt;typename _Tp &gt; </td></tr>
<tr class="memitem:ad8c591bacb34c485f5b7a250c314fc53 inherit pub_static_methods_classcv_1_1Algorithm"><td align="right" class="memTemplItemLeft" valign="top">static <a class="el" href="../../dc/d84/group__core__basic.html#ga6395ca871a678020c4a31fadf7e8cc63">Ptr</a>&lt; _Tp &gt; </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="../../d3/d46/classcv_1_1Algorithm.html#ad8c591bacb34c485f5b7a250c314fc53">read</a> (const <a class="el" href="../../de/dd9/classcv_1_1FileNode.html">FileNode</a> &amp;fn)</td></tr>
<tr class="memdesc:ad8c591bacb34c485f5b7a250c314fc53 inherit pub_static_methods_classcv_1_1Algorithm"><td class="mdescLeft"> </td><td class="mdescRight">Reads algorithm from the file node.  <a href="../../d3/d46/classcv_1_1Algorithm.html#ad8c591bacb34c485f5b7a250c314fc53">More...</a><br/></td></tr>
<tr class="separator:ad8c591bacb34c485f5b7a250c314fc53 inherit pub_static_methods_classcv_1_1Algorithm"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="inherit_header pro_methods_classcv_1_1Algorithm"><td colspan="2" onclick="javascript:toggleInherit('pro_methods_classcv_1_1Algorithm')"><img alt="-" src="../../closed.png"/> Protected Member Functions inherited from <a class="el" href="../../d3/d46/classcv_1_1Algorithm.html">cv::Algorithm</a></td></tr>
<tr class="memitem:a68eeca71617474ad3d4561786f0289d2 inherit pro_methods_classcv_1_1Algorithm"><td align="right" class="memItemLeft" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d46/classcv_1_1Algorithm.html#a68eeca71617474ad3d4561786f0289d2">writeFormat</a> (<a class="el" href="../../da/d56/classcv_1_1FileStorage.html">FileStorage</a> &amp;fs) const</td></tr>
<tr class="separator:a68eeca71617474ad3d4561786f0289d2 inherit pro_methods_classcv_1_1Algorithm"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a id="details" name="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Abstract base class for all face recognition models. </p>
<p>All face recognition models in OpenCV are derived from the abstract base class <a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html" title="Abstract base class for all face recognition models. ">FaceRecognizer</a>, which provides a unified access to all face recongition algorithms in OpenCV.</p>
<h3>Description</h3>
<p>I'll go a bit more into detail explaining <a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html" title="Abstract base class for all face recognition models. ">FaceRecognizer</a>, because it doesn't look like a powerful interface at first sight. But: Every <a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html" title="Abstract base class for all face recognition models. ">FaceRecognizer</a> is an <a class="el" href="../../d3/d46/classcv_1_1Algorithm.html" title="This is a base class for all more or less complex algorithms in OpenCV. ">Algorithm</a>, so you can easily get/set all model internals (if allowed by the implementation). <a class="el" href="../../d3/d46/classcv_1_1Algorithm.html" title="This is a base class for all more or less complex algorithms in OpenCV. ">Algorithm</a> is a relatively new OpenCV concept, which is available since the 2.4 release. I suggest you take a look at its description.</p>
<p><a class="el" href="../../d3/d46/classcv_1_1Algorithm.html" title="This is a base class for all more or less complex algorithms in OpenCV. ">Algorithm</a> provides the following features for all derived classes:</p>
<ul>
<li>So called "virtual constructor". That is, each <a class="el" href="../../d3/d46/classcv_1_1Algorithm.html" title="This is a base class for all more or less complex algorithms in OpenCV. ">Algorithm</a> derivative is registered at program start and you can get the list of registered algorithms and create instance of a particular algorithm by its name (see Algorithm::create). If you plan to add your own algorithms, it is good practice to add a unique prefix to your algorithms to distinguish them from other algorithms.</li>
<li>Setting/Retrieving algorithm parameters by name. If you used video capturing functionality from OpenCV highgui module, you are probably familar with cv::cvSetCaptureProperty, ocvcvGetCaptureProperty, <a class="el" href="../../d8/dfe/classcv_1_1VideoCapture.html#a8c6d8c2d37505b5ca61ffd4bb54e9a7c" title="Sets a property in the VideoCapture. ">VideoCapture::set</a> and <a class="el" href="../../d8/dfe/classcv_1_1VideoCapture.html#aa6480e6972ef4c00d74814ec841a2939" title="Returns the specified VideoCapture property. ">VideoCapture::get</a>. <a class="el" href="../../d3/d46/classcv_1_1Algorithm.html" title="This is a base class for all more or less complex algorithms in OpenCV. ">Algorithm</a> provides similar method where instead of integer id's you specify the parameter names as text Strings. See Algorithm::set and Algorithm::get for details.</li>
<li>Reading and writing parameters from/to XML or YAML files. Every <a class="el" href="../../d3/d46/classcv_1_1Algorithm.html" title="This is a base class for all more or less complex algorithms in OpenCV. ">Algorithm</a> derivative can store all its parameters and then read them back. There is no need to re-implement it each time.</li>
</ul>
<p>Moreover every <a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html" title="Abstract base class for all face recognition models. ">FaceRecognizer</a> supports the:</p>
<ul>
<li><b>Training</b> of a <a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html" title="Abstract base class for all face recognition models. ">FaceRecognizer</a> with <a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html#ac8680c2aa9649ad3f55e27761165c0d6" title="Trains a FaceRecognizer with given data and associated labels. ">FaceRecognizer::train</a> on a given set of images (your face database!).</li>
<li><b>Prediction</b> of a given sample image, that means a face. The image is given as a <a class="el" href="../../d3/d63/classcv_1_1Mat.html" title="n-dimensional dense array class ">Mat</a>.</li>
<li><b>Loading/Saving</b> the model state from/to a given XML or YAML.</li>
<li><b>Setting/Getting labels info</b>, that is stored as a string. String labels info is useful for keeping names of the recognized people.</li>
</ul>
<dl class="section note"><dt>Note</dt><dd>When using the <a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html" title="Abstract base class for all face recognition models. ">FaceRecognizer</a> interface in combination with Python, please stick to Python 2. Some underlying scripts like create_csv will not work in other versions, like Python 3. Setting the Thresholds +++++++++++++++++++++++</dd></dl>
<p>Sometimes you run into the situation, when you want to apply a threshold on the prediction. A common scenario in face recognition is to tell, whether a face belongs to the training dataset or if it is unknown. You might wonder, why there's no public API in <a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html" title="Abstract base class for all face recognition models. ">FaceRecognizer</a> to set the threshold for the prediction, but rest assured: It's supported. It just means there's no generic way in an abstract class to provide an interface for setting/getting the thresholds of <em>every possible</em> <a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html" title="Abstract base class for all face recognition models. ">FaceRecognizer</a> algorithm. The appropriate place to set the thresholds is in the constructor of the specific <a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html" title="Abstract base class for all face recognition models. ">FaceRecognizer</a> and since every <a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html" title="Abstract base class for all face recognition models. ">FaceRecognizer</a> is a <a class="el" href="../../d3/d46/classcv_1_1Algorithm.html" title="This is a base class for all more or less complex algorithms in OpenCV. ">Algorithm</a> (see above), you can get/set the thresholds at runtime!</p>
<p>Here is an example of setting a threshold for the Eigenfaces method, when creating the model:</p>
<div class="fragment"><div class="line"><span class="comment">// Let's say we want to keep 10 Eigenfaces and have a threshold value of 10.0</span></div><div class="line"><span class="keywordtype">int</span> num_components = 10;</div><div class="line"><span class="keywordtype">double</span> <a class="code" href="../../d7/d1b/group__imgproc__misc.html#gae8a4a146d1ca78c626a53577199e9c57">threshold</a> = 10.0;</div><div class="line"><span class="comment">// Then if you want to have a cv::FaceRecognizer with a confidence threshold,</span></div><div class="line"><span class="comment">// create the concrete implementation with the appropriate parameters:</span></div><div class="line">Ptr&lt;FaceRecognizer&gt; model = <a class="code" href="../../dd/d7c/classcv_1_1face_1_1EigenFaceRecognizer.html#a5ccb5a03dd0d8fb828f17670d9d28f68">EigenFaceRecognizer::create</a>(num_components, threshold);</div></div><!-- fragment --><p>Sometimes it's impossible to train the model, just to experiment with threshold values. Thanks to <a class="el" href="../../d3/d46/classcv_1_1Algorithm.html" title="This is a base class for all more or less complex algorithms in OpenCV. ">Algorithm</a> it's possible to set internal model thresholds during runtime. Let's see how we would set/get the prediction for the Eigenface model, we've created above:</p>
<div class="fragment"><div class="line"><span class="comment">// The following line reads the threshold from the Eigenfaces model:</span></div><div class="line"><span class="keywordtype">double</span> current_threshold = model-&gt;getDouble(<span class="stringliteral">"threshold"</span>);</div><div class="line"><span class="comment">// And this line sets the threshold to 0.0:</span></div><div class="line">model-&gt;set(<span class="stringliteral">"threshold"</span>, 0.0);</div></div><!-- fragment --><p>If you've set the threshold to 0.0 as we did above, then:</p>
<div class="fragment"><div class="line"><span class="comment">//</span></div><div class="line">Mat img = <a class="code" href="../../d4/da8/group__imgcodecs.html#ga288b8b3da0892bd651fce07b3bbd3a56">imread</a>(<span class="stringliteral">"person1/3.jpg"</span>, <a class="code" href="../../d8/d6a/group__imgcodecs__flags.html#gga61d9b0126a3e57d9277ac48327799c80ae29981cfc153d3b0cef5c0daeedd2125">IMREAD_GRAYSCALE</a>);</div><div class="line"><span class="comment">// Get a prediction from the model. Note: We've set a threshold of 0.0 above,</span></div><div class="line"><span class="comment">// since the distance is almost always larger than 0.0, you'll get -1 as</span></div><div class="line"><span class="comment">// label, which indicates, this face is unknown</span></div><div class="line"><span class="keywordtype">int</span> predicted_label = model-&gt;predict(img);</div><div class="line"><span class="comment">// ...</span></div></div><!-- fragment --><p>is going to yield -1 as predicted label, which states this face is unknown.</p>
<h3>Getting the name of a <a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html" title="Abstract base class for all face recognition models. ">FaceRecognizer</a></h3>
<p>Since every <a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html" title="Abstract base class for all face recognition models. ">FaceRecognizer</a> is a <a class="el" href="../../d3/d46/classcv_1_1Algorithm.html" title="This is a base class for all more or less complex algorithms in OpenCV. ">Algorithm</a>, you can use Algorithm::name to get the name of a <a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html" title="Abstract base class for all face recognition models. ">FaceRecognizer</a>:</p>
<div class="fragment"><div class="line"><span class="comment">// Create a FaceRecognizer:</span></div><div class="line">Ptr&lt;FaceRecognizer&gt; model = <a class="code" href="../../dd/d7c/classcv_1_1face_1_1EigenFaceRecognizer.html#a5ccb5a03dd0d8fb828f17670d9d28f68">EigenFaceRecognizer::create</a>();</div><div class="line"><span class="comment">// And here's how to get its name:</span></div><div class="line"><a class="code" href="../../dc/d84/group__core__basic.html#ga1f6634802eeadfd7245bc75cf3e216c2">String</a> name = model-&gt;name();</div></div><!-- fragment --> </div><h2 class="groupheader">Member Function Documentation</h2>
<a id="aa60dc36e03135d32b94deaf1bad873f3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa60dc36e03135d32b94deaf1bad873f3">◆ </a></span>empty()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual bool cv::face::FaceRecognizer::empty </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. </p>
<p>Reimplemented from <a class="el" href="../../d3/d46/classcv_1_1Algorithm.html#ab6a18f1825475643e94381697d413972">cv::Algorithm</a>.</p>
<p>Implemented in <a class="el" href="../../dc/dd7/classcv_1_1face_1_1BasicFaceRecognizer.html#abb6c25641a9fd6f7428aeeea7d0f1491">cv::face::BasicFaceRecognizer</a>.</p>
</div>
</div>
<a id="aa51b8afce8ffe8b77c26f15be27b930d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa51b8afce8ffe8b77c26f15be27b930d">◆ </a></span>getLabelInfo()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual <a class="el" href="../../dc/d84/group__core__basic.html#ga1f6634802eeadfd7245bc75cf3e216c2">String</a> cv::face::FaceRecognizer::getLabelInfo </td>
          <td>(</td>
          <td class="paramtype">int </td>
          <td class="paramname"><em>label</em></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table><table class="python_language"><tr><th colspan="999" style="text-align:left">Python:</th></tr><tr><td style="width: 20px;"></td><td>retval</td><td>=</td><td>cv.face_FaceRecognizer.getLabelInfo(</td><td class="paramname">label</td><td>)</td></tr></table>
</div><div class="memdoc">
<p>Gets string information by label. </p>
<p>If an unknown label id is provided or there is no label information associated with the specified label id the method returns an empty string. </p>
</div>
</div>
<a id="a68e818dcdadba76574a597db49b233ce"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a68e818dcdadba76574a597db49b233ce">◆ </a></span>getLabelsByString()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual std::vector&lt;int&gt; cv::face::FaceRecognizer::getLabelsByString </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="../../dc/d84/group__core__basic.html#ga1f6634802eeadfd7245bc75cf3e216c2">String</a> &amp; </td>
          <td class="paramname"><em>str</em></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table><table class="python_language"><tr><th colspan="999" style="text-align:left">Python:</th></tr><tr><td style="width: 20px;"></td><td>retval</td><td>=</td><td>cv.face_FaceRecognizer.getLabelsByString(</td><td class="paramname">str</td><td>)</td></tr></table>
</div><div class="memdoc">
<p>Gets vector of labels by string. </p>
<p>The function searches for the labels containing the specified sub-string in the associated string info. </p>
</div>
</div>
<a id="ad0ce3ced9c89b5aca528e8490dc18969"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad0ce3ced9c89b5aca528e8490dc18969">◆ </a></span>getThreshold()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual double cv::face::FaceRecognizer::getThreshold </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>threshold parameter accessor - required for default BestMinDist collector </p>
<p>Implemented in <a class="el" href="../../df/d25/classcv_1_1face_1_1LBPHFaceRecognizer.html#acf2a6993eb4347b3f89009da693a3f70">cv::face::LBPHFaceRecognizer</a>, and <a class="el" href="../../dc/dd7/classcv_1_1face_1_1BasicFaceRecognizer.html#ace6e9e6f3631223ef47606110d4233d6">cv::face::BasicFaceRecognizer</a>.</p>
</div>
</div>
<a id="aa2d2f02faffab1bf01317ae6502fb631"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa2d2f02faffab1bf01317ae6502fb631">◆ </a></span>predict() <span class="overload">[1/3]</span></h2>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int cv::face::FaceRecognizer::predict </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="../../dc/d84/group__core__basic.html#ga353a9de602fe76c709e12074a6f362ba">InputArray</a> </td>
          <td class="paramname"><em>src</em></td><td>)</td>
          <td> const</td>
        </tr>
      </table><table class="python_language"><tr><th colspan="999" style="text-align:left">Python:</th></tr><tr><td style="width: 20px;"></td><td>label, confidence</td><td>=</td><td>cv.face_FaceRecognizer.predict(</td><td class="paramname">src</td><td>)</td></tr><tr><td style="width: 20px;"></td><td>None</td><td>=</td><td>cv.face_FaceRecognizer.predict_collect(</td><td class="paramname">src, collector</td><td>)</td></tr><tr><td style="width: 20px;"></td><td>retval</td><td>=</td><td>cv.face_FaceRecognizer.predict_label(</td><td class="paramname">src</td><td>)</td></tr></table>
</div><div class="memdoc">
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. </p>
</div>
</div>
<a id="ab0d593e53ebd9a0f350c989fcac7f251"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab0d593e53ebd9a0f350c989fcac7f251">◆ </a></span>predict() <span class="overload">[2/3]</span></h2>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void cv::face::FaceRecognizer::predict </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="../../dc/d84/group__core__basic.html#ga353a9de602fe76c709e12074a6f362ba">InputArray</a> </td>
          <td class="paramname"><em>src</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int &amp; </td>
          <td class="paramname"><em>label</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">double &amp; </td>
          <td class="paramname"><em>confidence</em> </td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const</td>
        </tr>
      </table><table class="python_language"><tr><th colspan="999" style="text-align:left">Python:</th></tr><tr><td style="width: 20px;"></td><td>label, confidence</td><td>=</td><td>cv.face_FaceRecognizer.predict(</td><td class="paramname">src</td><td>)</td></tr><tr><td style="width: 20px;"></td><td>None</td><td>=</td><td>cv.face_FaceRecognizer.predict_collect(</td><td class="paramname">src, collector</td><td>)</td></tr><tr><td style="width: 20px;"></td><td>retval</td><td>=</td><td>cv.face_FaceRecognizer.predict_label(</td><td class="paramname">src</td><td>)</td></tr></table>
</div><div class="memdoc">
<p>Predicts a label and associated confidence (e.g. distance) for a given input image. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">src</td><td>Sample image to get a prediction from. </td></tr>
    <tr><td class="paramname">label</td><td>The predicted label for the given image. </td></tr>
    <tr><td class="paramname">confidence</td><td>Associated confidence (e.g. distance) for the predicted label.</td></tr>
  </table>
  </dd>
</dl>
<p>The suffix const means that prediction does not affect the internal model state, so the method can be safely called from within different threads.</p>
<p>The following example shows how to get a prediction from a trained model:</p>
<div class="fragment"><div class="line"><span class="keyword">using namespace </span><a class="code" href="../../d2/d75/namespacecv.html">cv</a>;</div><div class="line"><span class="comment">// Do your initialization here (create the cv::FaceRecognizer model) ...</span></div><div class="line"><span class="comment">// ...</span></div><div class="line"><span class="comment">// Read in a sample image:</span></div><div class="line"><a class="code" href="../../d3/d63/classcv_1_1Mat.html">Mat</a> img = <a class="code" href="../../d4/da8/group__imgcodecs.html#ga288b8b3da0892bd651fce07b3bbd3a56">imread</a>(<span class="stringliteral">"person1/3.jpg"</span>, <a class="code" href="../../d8/d6a/group__imgcodecs__flags.html#gga61d9b0126a3e57d9277ac48327799c80ae29981cfc153d3b0cef5c0daeedd2125">IMREAD_GRAYSCALE</a>);</div><div class="line"><span class="comment">// And get a prediction from the cv::FaceRecognizer:</span></div><div class="line"><span class="keywordtype">int</span> predicted = model-&gt;predict(img);</div></div><!-- fragment --><p>Or to get a prediction and the associated confidence (e.g. distance):</p>
<div class="fragment"><div class="line"><span class="keyword">using namespace </span><a class="code" href="../../d2/d75/namespacecv.html">cv</a>;</div><div class="line"><span class="comment">// Do your initialization here (create the cv::FaceRecognizer model) ...</span></div><div class="line"><span class="comment">// ...</span></div><div class="line"><a class="code" href="../../d3/d63/classcv_1_1Mat.html">Mat</a> img = <a class="code" href="../../d4/da8/group__imgcodecs.html#ga288b8b3da0892bd651fce07b3bbd3a56">imread</a>(<span class="stringliteral">"person1/3.jpg"</span>, <a class="code" href="../../d8/d6a/group__imgcodecs__flags.html#gga61d9b0126a3e57d9277ac48327799c80ae29981cfc153d3b0cef5c0daeedd2125">IMREAD_GRAYSCALE</a>);</div><div class="line"><span class="comment">// Some variables for the predicted label and associated confidence (e.g. distance):</span></div><div class="line"><span class="keywordtype">int</span> predicted_label = -1;</div><div class="line"><span class="keywordtype">double</span> predicted_confidence = 0.0;</div><div class="line"><span class="comment">// Get the prediction and associated confidence from the model</span></div><div class="line">model-&gt;predict(img, predicted_label, predicted_confidence);</div></div><!-- fragment --> 
</div>
</div>
<a id="afc5af8e603b525e9cdc6b3ddcd7cf83f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#afc5af8e603b525e9cdc6b3ddcd7cf83f">◆ </a></span>predict() <span class="overload">[3/3]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void cv::face::FaceRecognizer::predict </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="../../dc/d84/group__core__basic.html#ga353a9de602fe76c709e12074a6f362ba">InputArray</a> </td>
          <td class="paramname"><em>src</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="../../dc/d84/group__core__basic.html#ga6395ca871a678020c4a31fadf7e8cc63">Ptr</a>&lt; <a class="el" href="../../da/d6a/classcv_1_1face_1_1PredictCollector.html">PredictCollector</a> &gt; </td>
          <td class="paramname"><em>collector</em> </td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span>  </td>
  </tr>
</table><table class="python_language"><tr><th colspan="999" style="text-align:left">Python:</th></tr><tr><td style="width: 20px;"></td><td>label, confidence</td><td>=</td><td>cv.face_FaceRecognizer.predict(</td><td class="paramname">src</td><td>)</td></tr><tr><td style="width: 20px;"></td><td>None</td><td>=</td><td>cv.face_FaceRecognizer.predict_collect(</td><td class="paramname">src, collector</td><td>)</td></tr><tr><td style="width: 20px;"></td><td>retval</td><td>=</td><td>cv.face_FaceRecognizer.predict_label(</td><td class="paramname">src</td><td>)</td></tr></table>
</div><div class="memdoc">
<p><ul>
<li>if implemented - send all result of prediction to collector that can be used for somehow custom result handling </li>
</ul>
</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">src</td><td>Sample image to get a prediction from. </td></tr>
    <tr><td class="paramname">collector</td><td>User-defined collector object that accepts all results</td></tr>
  </table>
  </dd>
</dl>
<p>To implement this method u just have to do same internal cycle as in predict(InputArray src, CV_OUT int &amp;label, CV_OUT double &amp;confidence) but not try to get "best@ result, just resend it to caller side with given collector </p>
</div>
</div>
<a id="acc42e5b04595dba71f0777c7179af8c3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#acc42e5b04595dba71f0777c7179af8c3">◆ </a></span>read() <span class="overload">[1/2]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void cv::face::FaceRecognizer::read </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="../../dc/d84/group__core__basic.html#ga1f6634802eeadfd7245bc75cf3e216c2">String</a> &amp; </td>
          <td class="paramname"><em>filename</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table><table class="python_language"><tr><th colspan="999" style="text-align:left">Python:</th></tr><tr><td style="width: 20px;"></td><td>None</td><td>=</td><td>cv.face_FaceRecognizer.read(</td><td class="paramname">filename</td><td>)</td></tr></table>
</div><div class="memdoc">
<p>Loads a <a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html" title="Abstract base class for all face recognition models. ">FaceRecognizer</a> and its model state. </p>
<p>Loads a persisted model and state from a given XML or YAML file . Every <a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html" title="Abstract base class for all face recognition models. ">FaceRecognizer</a> has to overwrite FaceRecognizer::load(FileStorage&amp; fs) to enable loading the model state. FaceRecognizer::load(FileStorage&amp; fs) in turn gets called by FaceRecognizer::load(const String&amp; filename), to ease saving a model. </p>
</div>
</div>
<a id="a6ce52a3c8941aaa3cd09c31d6a6ef192"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6ce52a3c8941aaa3cd09c31d6a6ef192">◆ </a></span>read() <span class="overload">[2/2]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void cv::face::FaceRecognizer::read </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="../../de/dd9/classcv_1_1FileNode.html">FileNode</a> &amp; </td>
          <td class="paramname"><em>fn</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span>  </td>
  </tr>
</table><table class="python_language"><tr><th colspan="999" style="text-align:left">Python:</th></tr><tr><td style="width: 20px;"></td><td>None</td><td>=</td><td>cv.face_FaceRecognizer.read(</td><td class="paramname">filename</td><td>)</td></tr></table>
</div><div class="memdoc">
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. </p>
<p>Reimplemented from <a class="el" href="../../d3/d46/classcv_1_1Algorithm.html#aef2ad3f4145bd6e8c3664eb1c4b5e1e6">cv::Algorithm</a>.</p>
<p>Implemented in <a class="el" href="../../dc/dd7/classcv_1_1face_1_1BasicFaceRecognizer.html#af4ccaaa1001e0c9437b7e969be1cdf7b">cv::face::BasicFaceRecognizer</a>.</p>
</div>
</div>
<a id="aabcb47adcddd719974681b2b7309d656"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aabcb47adcddd719974681b2b7309d656">◆ </a></span>setLabelInfo()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void cv::face::FaceRecognizer::setLabelInfo </td>
          <td>(</td>
          <td class="paramtype">int </td>
          <td class="paramname"><em>label</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="../../dc/d84/group__core__basic.html#ga1f6634802eeadfd7245bc75cf3e216c2">String</a> &amp; </td>
          <td class="paramname"><em>strInfo</em> </td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table><table class="python_language"><tr><th colspan="999" style="text-align:left">Python:</th></tr><tr><td style="width: 20px;"></td><td>None</td><td>=</td><td>cv.face_FaceRecognizer.setLabelInfo(</td><td class="paramname">label, strInfo</td><td>)</td></tr></table>
</div><div class="memdoc">
<p>Sets string info for the specified model's label. </p>
<p>The string info is replaced by the provided value if it was set before for the specified label. </p>
</div>
</div>
<a id="a3182081e5f8023e658ad8ab96656dd63"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3182081e5f8023e658ad8ab96656dd63">◆ </a></span>setThreshold()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void cv::face::FaceRecognizer::setThreshold </td>
          <td>(</td>
          <td class="paramtype">double </td>
          <td class="paramname"><em>val</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Sets threshold of model. </p>
<p>Implemented in <a class="el" href="../../df/d25/classcv_1_1face_1_1LBPHFaceRecognizer.html#a4b4903dcfaa98192784a41b299360b5c">cv::face::LBPHFaceRecognizer</a>, and <a class="el" href="../../dc/dd7/classcv_1_1face_1_1BasicFaceRecognizer.html#a5b9e5e5ee62922e6a3f6cec8110eef26">cv::face::BasicFaceRecognizer</a>.</p>
</div>
</div>
<a id="ac8680c2aa9649ad3f55e27761165c0d6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac8680c2aa9649ad3f55e27761165c0d6">◆ </a></span>train()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void cv::face::FaceRecognizer::train </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="../../dc/d84/group__core__basic.html#ga606feabe3b50ab6838f1ba89727aa07a">InputArrayOfArrays</a> </td>
          <td class="paramname"><em>src</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="../../dc/d84/group__core__basic.html#ga353a9de602fe76c709e12074a6f362ba">InputArray</a> </td>
          <td class="paramname"><em>labels</em> </td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span>  </td>
  </tr>
</table><table class="python_language"><tr><th colspan="999" style="text-align:left">Python:</th></tr><tr><td style="width: 20px;"></td><td>None</td><td>=</td><td>cv.face_FaceRecognizer.train(</td><td class="paramname">src, labels</td><td>)</td></tr></table>
</div><div class="memdoc">
<p>Trains a <a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html" title="Abstract base class for all face recognition models. ">FaceRecognizer</a> with given data and associated labels. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">src</td><td>The training images, that means the faces you want to learn. The data has to be given as a vector&lt;<a class="el" href="../../d3/d63/classcv_1_1Mat.html" title="n-dimensional dense array class ">Mat</a>&gt;. </td></tr>
    <tr><td class="paramname">labels</td><td>The labels corresponding to the images have to be given either as a vector&lt;int&gt; or a <a class="el" href="../../d3/d63/classcv_1_1Mat.html" title="n-dimensional dense array class ">Mat</a> of type CV_32SC1.</td></tr>
  </table>
  </dd>
</dl>
<p>The following source code snippet shows you how to learn a Fisherfaces model on a given set of images. The images are read with imread and pushed into a std::vector&lt;<a class="el" href="../../d3/d63/classcv_1_1Mat.html" title="n-dimensional dense array class ">Mat</a>&gt;. The labels of each image are stored within a std::vector&lt;int&gt; (you could also use a <a class="el" href="../../d3/d63/classcv_1_1Mat.html" title="n-dimensional dense array class ">Mat</a> of type CV_32SC1). Think of the label as the subject (the person) this image belongs to, so same subjects (persons) should have the same label. For the available <a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html" title="Abstract base class for all face recognition models. ">FaceRecognizer</a> you don't have to pay any attention to the order of the labels, just make sure same persons have the same label:</p>
<div class="fragment"><div class="line"><span class="comment">// holds images and labels</span></div><div class="line">vector&lt;Mat&gt; images;</div><div class="line">vector&lt;int&gt; labels;</div><div class="line"><span class="comment">// using Mat of type CV_32SC1</span></div><div class="line"><span class="comment">// Mat labels(number_of_samples, 1, CV_32SC1);</span></div><div class="line"><span class="comment">// images for first person</span></div><div class="line">images.push_back(<a class="code" href="../../d4/da8/group__imgcodecs.html#ga288b8b3da0892bd651fce07b3bbd3a56">imread</a>(<span class="stringliteral">"person0/0.jpg"</span>, <a class="code" href="../../d8/d6a/group__imgcodecs__flags.html#gga61d9b0126a3e57d9277ac48327799c80ae29981cfc153d3b0cef5c0daeedd2125">IMREAD_GRAYSCALE</a>)); labels.push_back(0);</div><div class="line">images.push_back(<a class="code" href="../../d4/da8/group__imgcodecs.html#ga288b8b3da0892bd651fce07b3bbd3a56">imread</a>(<span class="stringliteral">"person0/1.jpg"</span>, <a class="code" href="../../d8/d6a/group__imgcodecs__flags.html#gga61d9b0126a3e57d9277ac48327799c80ae29981cfc153d3b0cef5c0daeedd2125">IMREAD_GRAYSCALE</a>)); labels.push_back(0);</div><div class="line">images.push_back(<a class="code" href="../../d4/da8/group__imgcodecs.html#ga288b8b3da0892bd651fce07b3bbd3a56">imread</a>(<span class="stringliteral">"person0/2.jpg"</span>, <a class="code" href="../../d8/d6a/group__imgcodecs__flags.html#gga61d9b0126a3e57d9277ac48327799c80ae29981cfc153d3b0cef5c0daeedd2125">IMREAD_GRAYSCALE</a>)); labels.push_back(0);</div><div class="line"><span class="comment">// images for second person</span></div><div class="line">images.push_back(<a class="code" href="../../d4/da8/group__imgcodecs.html#ga288b8b3da0892bd651fce07b3bbd3a56">imread</a>(<span class="stringliteral">"person1/0.jpg"</span>, <a class="code" href="../../d8/d6a/group__imgcodecs__flags.html#gga61d9b0126a3e57d9277ac48327799c80ae29981cfc153d3b0cef5c0daeedd2125">IMREAD_GRAYSCALE</a>)); labels.push_back(1);</div><div class="line">images.push_back(<a class="code" href="../../d4/da8/group__imgcodecs.html#ga288b8b3da0892bd651fce07b3bbd3a56">imread</a>(<span class="stringliteral">"person1/1.jpg"</span>, <a class="code" href="../../d8/d6a/group__imgcodecs__flags.html#gga61d9b0126a3e57d9277ac48327799c80ae29981cfc153d3b0cef5c0daeedd2125">IMREAD_GRAYSCALE</a>)); labels.push_back(1);</div><div class="line">images.push_back(<a class="code" href="../../d4/da8/group__imgcodecs.html#ga288b8b3da0892bd651fce07b3bbd3a56">imread</a>(<span class="stringliteral">"person1/2.jpg"</span>, <a class="code" href="../../d8/d6a/group__imgcodecs__flags.html#gga61d9b0126a3e57d9277ac48327799c80ae29981cfc153d3b0cef5c0daeedd2125">IMREAD_GRAYSCALE</a>)); labels.push_back(1);</div></div><!-- fragment --><p>Now that you have read some images, we can create a new <a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html" title="Abstract base class for all face recognition models. ">FaceRecognizer</a>. In this example I'll create a Fisherfaces model and decide to keep all of the possible Fisherfaces:</p>
<div class="fragment"><div class="line"><span class="comment">// Create a new Fisherfaces model and retain all available Fisherfaces,</span></div><div class="line"><span class="comment">// this is the most common usage of this specific FaceRecognizer:</span></div><div class="line"><span class="comment">//</span></div><div class="line">Ptr&lt;FaceRecognizer&gt; model =  <a class="code" href="../../d2/de9/classcv_1_1face_1_1FisherFaceRecognizer.html#a0072e4c3f410250baf4b083296a41dfc">FisherFaceRecognizer::create</a>();</div></div><!-- fragment --><p>And finally train it on the given dataset (the face images and labels):</p>
<div class="fragment"><div class="line"><span class="comment">// This is the common interface to train all of the available cv::FaceRecognizer</span></div><div class="line"><span class="comment">// implementations:</span></div><div class="line"><span class="comment">//</span></div><div class="line">model-&gt;train(images, labels);</div></div><!-- fragment --> 
</div>
</div>
<a id="a8a4e73ea878dcd0c235d0487189d25f3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8a4e73ea878dcd0c235d0487189d25f3">◆ </a></span>update()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void cv::face::FaceRecognizer::update </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="../../dc/d84/group__core__basic.html#ga606feabe3b50ab6838f1ba89727aa07a">InputArrayOfArrays</a> </td>
          <td class="paramname"><em>src</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="../../dc/d84/group__core__basic.html#ga353a9de602fe76c709e12074a6f362ba">InputArray</a> </td>
          <td class="paramname"><em>labels</em> </td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table><table class="python_language"><tr><th colspan="999" style="text-align:left">Python:</th></tr><tr><td style="width: 20px;"></td><td>None</td><td>=</td><td>cv.face_FaceRecognizer.update(</td><td class="paramname">src, labels</td><td>)</td></tr></table>
</div><div class="memdoc">
<p>Updates a <a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html" title="Abstract base class for all face recognition models. ">FaceRecognizer</a> with given data and associated labels. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">src</td><td>The training images, that means the faces you want to learn. The data has to be given as a vector&lt;<a class="el" href="../../d3/d63/classcv_1_1Mat.html" title="n-dimensional dense array class ">Mat</a>&gt;. </td></tr>
    <tr><td class="paramname">labels</td><td>The labels corresponding to the images have to be given either as a vector&lt;int&gt; or a <a class="el" href="../../d3/d63/classcv_1_1Mat.html" title="n-dimensional dense array class ">Mat</a> of type CV_32SC1.</td></tr>
  </table>
  </dd>
</dl>
<p>This method updates a (probably trained) <a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html" title="Abstract base class for all face recognition models. ">FaceRecognizer</a>, but only if the algorithm supports it. The Local Binary Patterns Histograms (LBPH) recognizer (see createLBPHFaceRecognizer) can be updated. For the Eigenfaces and Fisherfaces method, this is algorithmically not possible and you have to re-estimate the model with <a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html#ac8680c2aa9649ad3f55e27761165c0d6" title="Trains a FaceRecognizer with given data and associated labels. ">FaceRecognizer::train</a>. In any case, a call to train empties the existing model and learns a new model, while update does not delete any model data.</p>
<div class="fragment"><div class="line"><span class="comment">// Create a new LBPH model (it can be updated) and use the default parameters,</span></div><div class="line"><span class="comment">// this is the most common usage of this specific FaceRecognizer:</span></div><div class="line"><span class="comment">//</span></div><div class="line">Ptr&lt;FaceRecognizer&gt; model =  <a class="code" href="../../df/d25/classcv_1_1face_1_1LBPHFaceRecognizer.html#ac33ba992b16f29f2824761cea5cd5fc5">LBPHFaceRecognizer::create</a>();</div><div class="line"><span class="comment">// This is the common interface to train all of the available cv::FaceRecognizer</span></div><div class="line"><span class="comment">// implementations:</span></div><div class="line"><span class="comment">//</span></div><div class="line">model-&gt;train(images, labels);</div><div class="line"><span class="comment">// Some containers to hold new image:</span></div><div class="line">vector&lt;Mat&gt; newImages;</div><div class="line">vector&lt;int&gt; newLabels;</div><div class="line"><span class="comment">// You should add some images to the containers:</span></div><div class="line"><span class="comment">//</span></div><div class="line"><span class="comment">// ...</span></div><div class="line"><span class="comment">//</span></div><div class="line"><span class="comment">// Now updating the model is as easy as calling:</span></div><div class="line">model-&gt;update(newImages,newLabels);</div><div class="line"><span class="comment">// This will preserve the old model data and extend the existing model</span></div><div class="line"><span class="comment">// with the new features extracted from newImages!</span></div></div><!-- fragment --><p>Calling update on an Eigenfaces model (see <a class="el" href="../../dd/d7c/classcv_1_1face_1_1EigenFaceRecognizer.html#a5ccb5a03dd0d8fb828f17670d9d28f68">EigenFaceRecognizer::create</a>), which doesn't support updating, will throw an error similar to:</p>
<div class="fragment"><div class="line">OpenCV Error: The <span class="keyword">function</span>/feature is not implemented (This FaceRecognizer (FaceRecognizer.Eigenfaces) does not support updating, you have to use <a class="code" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html#ac8680c2aa9649ad3f55e27761165c0d6">FaceRecognizer::train</a> to <a class="code" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html#a8a4e73ea878dcd0c235d0487189d25f3">update</a> it.) in <a class="code" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html#a8a4e73ea878dcd0c235d0487189d25f3">update</a>, file /home/philipp/git/opencv/modules/contrib/src/facerec.cpp, <a class="code" href="../../d6/d6e/group__imgproc__draw.html#ga7078a9fae8c7e7d13d24dac2520ae4a2">line</a> 305</div><div class="line">terminate called after throwing an instance of <span class="stringliteral">'cv::Exception'</span></div></div><!-- fragment --><dl class="section note"><dt>Note</dt><dd>The <a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html" title="Abstract base class for all face recognition models. ">FaceRecognizer</a> does not store your training images, because this would be very memory intense and it's not the responsibility of te <a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html" title="Abstract base class for all face recognition models. ">FaceRecognizer</a> to do so. The caller is responsible for maintaining the dataset, he want to work with. </dd></dl>
</div>
</div>
<a id="a2adf2d555550194244b05c91fefcb4d6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2adf2d555550194244b05c91fefcb4d6">◆ </a></span>write() <span class="overload">[1/2]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void cv::face::FaceRecognizer::write </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="../../dc/d84/group__core__basic.html#ga1f6634802eeadfd7245bc75cf3e216c2">String</a> &amp; </td>
          <td class="paramname"><em>filename</em></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table><table class="python_language"><tr><th colspan="999" style="text-align:left">Python:</th></tr><tr><td style="width: 20px;"></td><td>None</td><td>=</td><td>cv.face_FaceRecognizer.write(</td><td class="paramname">filename</td><td>)</td></tr></table>
</div><div class="memdoc">
<p>Saves a <a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html" title="Abstract base class for all face recognition models. ">FaceRecognizer</a> and its model state. </p>
<p>Saves this model to a given filename, either as XML or YAML. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">filename</td><td>The filename to store this <a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html" title="Abstract base class for all face recognition models. ">FaceRecognizer</a> to (either XML/YAML).</td></tr>
  </table>
  </dd>
</dl>
<p>Every <a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html" title="Abstract base class for all face recognition models. ">FaceRecognizer</a> overwrites FaceRecognizer::save(FileStorage&amp; fs) to save the internal model state. FaceRecognizer::save(const String&amp; filename) saves the state of a model to the given filename.</p>
<p>The suffix const means that prediction does not affect the internal model state, so the method can be safely called from within different threads. </p>
</div>
</div>
<a id="a4756dbf9b97408ba5f3677296c3a1695"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4756dbf9b97408ba5f3677296c3a1695">◆ </a></span>write() <span class="overload">[2/2]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void cv::face::FaceRecognizer::write </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="../../da/d56/classcv_1_1FileStorage.html">FileStorage</a> &amp; </td>
          <td class="paramname"><em>fs</em></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span>  </td>
  </tr>
</table><table class="python_language"><tr><th colspan="999" style="text-align:left">Python:</th></tr><tr><td style="width: 20px;"></td><td>None</td><td>=</td><td>cv.face_FaceRecognizer.write(</td><td class="paramname">filename</td><td>)</td></tr></table>
</div><div class="memdoc">
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Saves this model to a given <a class="el" href="../../da/d56/classcv_1_1FileStorage.html" title="XML/YAML/JSON file storage class that encapsulates all the information necessary for writing or readi...">FileStorage</a>. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">fs</td><td>The <a class="el" href="../../da/d56/classcv_1_1FileStorage.html" title="XML/YAML/JSON file storage class that encapsulates all the information necessary for writing or readi...">FileStorage</a> to store this <a class="el" href="../../dd/d65/classcv_1_1face_1_1FaceRecognizer.html" title="Abstract base class for all face recognition models. ">FaceRecognizer</a> to. </td></tr>
  </table>
  </dd>
</dl>
<p>Reimplemented from <a class="el" href="../../d3/d46/classcv_1_1Algorithm.html#a1f8ad7b8add515077367fb9949a174d2">cv::Algorithm</a>.</p>
<p>Implemented in <a class="el" href="../../dc/dd7/classcv_1_1face_1_1BasicFaceRecognizer.html#a7f0e55c29e3c982f389cf601141359ac">cv::face::BasicFaceRecognizer</a>.</p>
</div>
</div>
<h2 class="groupheader">Member Data Documentation</h2>
<a id="aa24774c798eb4d682d8ee10dbf9c8c45"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa24774c798eb4d682d8ee10dbf9c8c45">◆ </a></span>_labelsInfo</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">std::map&lt;int, <a class="el" href="../../dc/d84/group__core__basic.html#ga1f6634802eeadfd7245bc75cf3e216c2">String</a>&gt; cv::face::FaceRecognizer::_labelsInfo</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>opencv2/<a class="el" href="../../d3/dc8/face_8hpp.html">face.hpp</a></li>
</ul>
</div><!-- contents -->
<!-- HTML footer for doxygen 1.8.6-->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri Apr 2 2021 11:36:47 for OpenCV by  <a href="http://www.doxygen.org/index.html">
<img alt="doxygen" class="footer" src="../../doxygen.png"/>
</a> 1.8.13
</small></address>
<script type="text/javascript">
//<![CDATA[
addTutorialsButtons();
//]]>
</script>
</body>
</html>
